package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.technology.entity.Item;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;

/**
 * 设备BOM对象 MB_ERP_EQUIPMENT_BOM
 *
 * @author Cheng
 * @date 2023-07-01
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_BOM")
@Schema(description="设备（类型）BOM")
public class EquipmentBom extends BaseEntity {

private static final long serialVersionUID=1L;

    @Id
    @Generator(policy = UUIDPolicy.class)
    @Column(name = "ID_")
    @Schema(description = "主键")
    private String id;

    @Column(name = "EQP_CODE_")
    @Schema(description = "设备编码")
    @Dict(dicCode = "eqpCode", dicEntity = Equipment.class, dicText = "eqpName")
    private String eqpCode;

    @Column(name = "BOM_NAME_")
    @Schema(description = "BOM名称")
    private String bomName;

    @Column(name = "BOM_CODE_")
    @Schema(description = "BOM编码")
    private String bomCode;

    @Column(name = "SPEC_TYPE_")
    @Schema(description = "规格尺寸")
    private String specType;

    @Column(name = "LIFE_CYCLE_")
    @Schema(description = "生命周期(月)")
    private Integer lifeCycle;

    @Column(name = "BIND_DATE_")
    @Schema(description = "绑定日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date bindDate;

    @Column(name = "WARN_DATE_")
    @Schema(description = "预警日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date warnDate;

    @Column(name = "IS_DEL_")
    @Schema(description = "是否删除（0-正常；1删除）")
    private Integer isDel;

    @Column(name = "PIC_")
    @Schema(description = "图片地址")
    private String pic;

    @Column(name = "SORT_")
    @Schema(description = "排序")
    private Integer sort;

    @Column(name = "QUANTITY_")
    @Schema(description = "需求数量")
    private Integer quantity;

    @Transient
    private Item bom;
}
